package com.umgsai.thread.thread74;

public class Task {

	private String getData1;
    private String getData2;
    public synchronized void doLongTimeTask1() {
        try {
            System.out.println("begin task...");
            Thread.sleep(3000);
            getData1 = "长时间处理任务后的返回值1 threadName=" + Thread.currentThread().getName();
            getData2 = "长时间处理任务后的返回值2 threadName=" + Thread.currentThread().getName();
            System.out.println(getData1);
            System.out.println(getData2);
            System.out.println("end task...");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    
    public void doLongTimeTask() {
        try {
            System.out.println("begin task...");
            //并发
            Thread.sleep(3000);
            System.out.println(System.currentTimeMillis());
            synchronized(this){
            	//
	            getData1 = "长时间处理任务后的返回值1 threadName=" + Thread.currentThread().getName();
	            getData2 = "长时间处理任务后的返回值2 threadName=" + Thread.currentThread().getName();
	            System.out.println(getData1);
	            System.out.println(getData2);
            }
            System.out.println("end task...");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
